package com.feishi.project.webbase.bean;

import lombok.Data;
import lombok.RequiredArgsConstructor;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: caixq
 * Date: 2019-03-04
 * Time: 上午11:09
 */
@Data
@RequiredArgsConstructor
public class WebResult<T> {
    private int errorCode;
    private String msg;
    private T data;

    public static WebResult createWebResult(String msg, int code) {
        return createWebResult(msg,code,null);
    }
    public static WebResult createWebResult( int code) {
        return createWebResult(null,code,null);
    }
    public static WebResult createWebResult(String msg) {
        return createWebResult(msg,0,null);
    }
    public static <T> WebResult<T> createWebResult(String msg, int errorCode,T data) {
        WebResult<T> result=new WebResult();
        result.setMsg(msg);
        result.setErrorCode(errorCode);
        result.setData(data);
        return result;
    }
}
